import httpsRequest from '@/assets/httpsRequest';

export default {
  namespaced: true,
  state: {
    newsList: [],
  },
  actions: {
    async getNewsList({ commit }) {
      const res = await httpsRequest({
        url: 'getNewslist',
      });
      const { status, data = {} } = res;
      const { message = [] } = data;
      if (status === 200) {
        commit({
          type: 'setNewsList',
          payload: {
            newsList: message,
          },
        });
      }
    },
  },
  mutations: {
    setNewsList(state, { payload }) {
      Object.assign(state, payload);
    },
  },
  getters: {
  },
};
